import requests

import app


class employeeApi:
    def __init__(self):
        self.url_add_employee = app.BASE_URL + "/api/sys/user"
        self.url_update_employee = app.BASE_URL + "/api/sys/user/{}"
        self.url_get_employee = app.BASE_URL + "/api/sys/user/{}"
        self.url_delete_employee = app.BASE_URL + "/api/sys/user/{}"

    def add_employee(self,add_employee_data):
        return requests.post(url=self.url_add_employee,json=add_employee_data,headers=app.headers_data)

    def update_employee(self,employee_id,updata_employee):
        url = self.url_update_employee.format(employee_id)
        return requests.put(url=url,json=updata_employee,headers=app.headers_data)

    def get_employee(self, employee_id):
        url = self.url_update_employee.format(employee_id)
        return requests.get(url=url, headers=app.headers_data)

    def delete_employee(self, employee_id):
        url = self.url_update_employee.format(employee_id)
        return requests.delete(url=url, headers=app.headers_data)
